package com.coe.demo.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.coe.demo.dao.IUserDAO;
import com.coe.demo.entity.User;

@Repository
public class UserDAO extends BaseDAO implements IUserDAO {

	public User findUser(String userName, String password) {
		String hql="select u from User as u where u.userName=? and u.password=?";
		 List list=this.getHibernateTemplate().find(hql,new Object[]{userName,password});
//		 if(list!=null&&list.size()>0)
//		 {
//			 return (User)list.get(0);
//		 }else
//		 {
//			 return null;
//		 }
		return list!=null&&list.size()>0?(User)list.get(0):null;
	}

}
